#pragma once

#include "fxcc/core/graph/common/pch.h"

#define MAX_DirNum 8
#define MAX_PointNum 8
#define MAX_SpotNum  8

namespace fxcc
{
    namespace graph {

        namespace common
        {
            using namespace glm;

            struct FXCC_API DirLight
            {
                struct FXCC_API Buffer
                {
                    vec3 ambient = vec3(0.5f, 0.5f, 0.5f);
                    int ambientMap = 0;

                    vec3 diffuse = vec3(0.5f, 0.5f, 0.5f);
                    int diffuseMap = 0;

                    vec3 specular = vec3(0.5f, 0.5f, 0.5f);
                    int specularMap = 0;

                    vec3 direction = vec3(0.0f, -1.0f, 0.f);
                    float pad;
                } m_Buffer;
         
            };

            struct FXCC_API PointLight
            {
                struct FXCC_API Buffer
                {
                    vec3 ambient = vec3(0.5f, 0.5f, 0.5f);
                    int ambientMap = 0;

                    vec3 diffuse = vec3(0.5f, 0.5f, 0.5f);
                    int diffuseMap = 0;

                    vec3 specular = vec3(0.5f, 0.5f, 0.5f);
                    int specularMap = 0;

                    vec3 position = vec3(0.0f);
                    float pad;

                    vec3 lightPbrColor = vec3(0.f);
                    float pad2;

                    float constant = 1.0f;
                    float linear = 0.09;
                    float quadratic = 0.032;
                    float pad4;
                } m_Buffer;

            };

            struct FXCC_API SpotLight
            {
                struct FXCC_API Buffer
                {
                    vec3 ambient = vec3(0.5f, 0.5f, 0.5f);
                    int ambientMap = 0;

                    vec3 diffuse = vec3(0.5f, 0.5f, 0.5f);
                    int diffuseMap = 0;

                    vec3 specular = vec3(0.5f, 0.5f, 0.5f);
                    int specularMap = 0;


                    vec3 position = vec3(0.0f, 2.0f, 0.f);
                    float cutOff = glm::cos(glm::radians(12.5f));
                    vec3 direction = vec3(0.f, -1.0f, 0.0f);
                    float outerCutOff = glm::cos(glm::radians(15.0f));

                    float constant = 1.0f;
                    float linear = 0.09;
                    float quadratic = 0.032;
                    float pad;
                }m_Buffer;

            };

            struct FXCC_API LightEffect {

                DirLight dirlights[MAX_DirNum];
                PointLight pointLights[MAX_PointNum];
                SpotLight spotLights[MAX_SpotNum];

                int numDirlights = 0;
                int numPoints = 0;
                int numSpotLights = 0;
                int Pad_0 = 0;

                bool hasLeftDirLight() const
                {
                    return numDirlights < MAX_DirNum - 1;
                }
                bool hasLeftPointLight() const
                {
                    return numPoints < MAX_PointNum - 1;
                }
                bool hasLeftSpotLight() const
                {
                    return numSpotLights < MAX_SpotNum - 1;
                }
            };
        };
    };
};
